package com.itheima.article.task;

import com.itheima.article.service.ApArticleService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class ComputeHotArticleTask {

    @Autowired
    private ApArticleService apArticleService;

    @XxlJob("computeHotArticleTask")
    public ReturnT<String> computeHotArticle(String param){
        log.info("定时任务 热点文章计算开始：param={}",param);

        apArticleService.computeAndSave2Redis();
        log.info("定时任务 热点文章计算结束：param={}",param);

        return ReturnT.SUCCESS;
    }
}
